﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UserCalender.ascx.cs" Inherits="MyOA.UI.UserControl.UserCalender" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>


<style type="text/css">
        
        
 

.textbox
{
	border-width:0px;
	background-image:url(../../images/Calendar.png);
	background-position:right;
	background-repeat:no-repeat;
	width:200px;
	
}


.calender
{
	color: #003399; 
    font-family: "宋体"; 
    font-style: normal; 
    border: 1px #93BEE2 solid; 
    margin:0px;
    padding:0px;
    
    width:130px;
    height:15px;
}

.img
{
	height:18px;
	vertical-align:middle;
}

span
{
	text-align:left;
}
    </style>
   <script type="text/javascript" src="../../js/My97DatePicker/WdatePicker.js"></script>
    <script>
    //获取本月 本日 本周
    function fillstring(str)
		{
			if(str.length==1)
			{
				str = "0" + str; 
			}
			return(str);
		}
    function quickseldate(type)
		{
		   // alert(type);
		   var now=new Date();
		   var hours=now.getHours();
		   var min=now.getMinutes();
		   var sec=now.getSeconds();
			var begintime,endtime;
			var oneminute = 60*1000;
			var onehour   = 60*oneminute;
			var oneday    = 24*onehour;
			var oneweek   = 7*oneday;
			
			var todayDate = new Date();
			var date = todayDate.getDate();
			var month= todayDate.getMonth() +1;
			var year= todayDate.getYear();
			var day = todayDate.getDay();
			if(navigator.appName == "Netscape")
			{
			 alert(type);
				year = 1900 + year;
			}

			//-->
						
			if(type=="day")
			{
				begintime = year.toString() + "-" + fillstring(month.toString()) + "-" + 

fillstring(date.toString())+" "+hours+":"+min+":"+sec;
				endtime = begintime;
			}
			else if(type=="week")
			{ 
				var daytoMon = day-1;
				if(day==0) 
					daytoMon = 6;
				
				todayDate.setTime(todayDate.getTime()-daytoMon*oneday);
				date = todayDate.getDate();
				month= todayDate.getMonth() +1;
				year= todayDate.getYear();
				day = todayDate.getDay();
				
				begintime = year.toString() + "-" + fillstring(month.toString()) + "-" + 

fillstring(date.toString())+" "+hours+":"+min+":"+sec;
				
				todayDate.setTime(todayDate.getTime()+6*oneday);
				
				date = todayDate.getDate();
				month= todayDate.getMonth() +1;
				year= todayDate.getYear();
				
				endtime = year.toString() + "-" + fillstring(month.toString()) + "-" + 

fillstring(date.toString())+" "+hours+":"+min+":"+sec;
			}
			else if(type=="month")
			{
				var dateto1 = date-1;
				
				todayDate.setTime(todayDate.getTime()-dateto1*oneday);
				date = todayDate.getDate();
				month= todayDate.getMonth() +1;
				year= todayDate.getYear();
				day = todayDate.getDay();
				
				begintime = year.toString() + "-" + fillstring(month.toString()) + "-" + 

fillstring(date.toString())+" "+hours+":"+min+":"+sec;
				
				todayDate.setMonth(month);
				todayDate.setTime(todayDate.getTime()-oneday);
				
				date = todayDate.getDate();
				month= todayDate.getMonth() +1;
				year= todayDate.getYear();
				
				endtime = year.toString() + "-" + fillstring(month.toString()) + "-" + 

fillstring(date.toString())+" "+hours+":"+min+":"+sec;

			}

			document.getElementById("<% = txtStart.ClientID  %>").value = begintime;
			document.getElementById("<% = txtEnd.ClientID  %>").value = endtime;
		
		}
		
		</script>
		
		

    开始时间：
    <span id="startTime">
        
        
        <asp:TextBox ID="txtStart" runat="server" CssClass="textbox calender"  Enabled="true" onclick="this.value='';new WdatePicker(this,'%Y-%M-%D %h:%m:%s',true,'whyGreen')"></asp:TextBox>
   
</span>

<span>
&nbsp;&nbsp;
-------
&nbsp;&nbsp;
</span>



    结束时间：
    <span id="endTime">
         <asp:TextBox ID="txtEnd" runat="server" CssClass="textbox calender"  Enabled="true" onclick="this.value='';new WdatePicker(this,'%Y-%M-%D %h:%m:%s',true,'whyGreen')"></asp:TextBox>
      
</span>

<span>
    <input id="rdoMonth" type="radio" onclick="quickseldate('month')" name="time"/>本月
 </span>

<span>
    <input id="rdoWeek" type="radio" onclick="quickseldate('week')" name="time"/>本周
 </span>
 
 <span>
    <input id="rdoDay" type="radio"  onclick="quickseldate('day')" name="time" />本日
 </span>